<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class Report extends Model
{
    use HasFactory, SoftDeletes;

    /**
     * 可批量赋值的属性
     *
     * @var array<string>
     */
    protected $fillable = [
        'user_id',
        'influencer_id',
        'type',
        'content',
        'evidence',
        'severity_level',
        'processed_at',
        'admin_remark',
    ];

    /**
     * 应该被转换为原生类型的属性
     *
     * @var array<string, string>
     */
    protected $casts = [
        'evidence' => 'json',
        'processed_at' => 'datetime',
    ];

    /**
     * 获取举报用户
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }

    /**
     * 获取被举报的网红
     */
    public function influencer(): BelongsTo
    {
        return $this->belongsTo(Influencer::class);
    }
} 